1 - (Time : 1:30 minutes, Each group maximum 4 children).
Laptop or desktop with Mu Editor installed.
CircuitPython installed on CPX board.
Circuit express board (CPX),Crickit,5v battery,USB cable.
Color sensor or any sensor of your choice
Jumper wires.
Students should know
Choose any sensor. Learn how the sensor works and what type of data it gives.
In this lesson, we will use a color sensor as the example. There will be a code in the sensor to indicate the model. You can use that code to look up documentation and code references for that sensor. In our case, the color sensor has code -> TCS230. We will look that up and learn about the sensor
Click here to see how the color sensor worksConnect the selected sensor to the CPX or Crickit sensor ports using jumper wires.
The color sensor does not work with the crickit and has to be connected to the CPX. Follow this wiring diagram for the color sensor.
Write a CircuitPython program to read the raw values from the sensor.
For the color sensor, this means reading the Red, Green, and Blue values.
Click here to see the sample codeUse simple logic to understand and use the sensor values.
For the color sensor, compare RGB values to decide whether the object is red, green, or blue. Test the program using different colored objects.
If two different objects look the same color to our eyes, will the color sensor always read the same RGB values for them? Why or why not?
Can you think of some of the commonly encountered sensors around you? (Talk about sensors in cars, phones, etc)